package com.frejoys.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.UserLevelMoneyLogListDto;
import com.frejoys.common.vo.admin.UserLevelMoneyLogListVo;
import com.frejoys.dao.entity.UserLevelMoneyLog;

import java.math.BigDecimal;


public interface UserLevelMoneyLogService extends IService<UserLevelMoneyLog> {

    default UserLevelMoneyLog getOnly(QueryWrapper<UserLevelMoneyLog> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default UserLevelMoneyLog getOnly(LambdaQueryWrapper<UserLevelMoneyLog> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     * 添加信息
     * @param userId
     * @param childUserId
     * @param drawSn
     * @param money
     * @param type
     * @return
     */
    boolean addInfo(Long userId, Long childUserId, Long drawSn, BigDecimal money, Integer type);

    // 用户推广收益明细列表
    IPage<UserLevelMoneyLogListVo> userLevelMoneyLogListInfo(UserLevelMoneyLogListDto dto);
}
